-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add simple JS config migration #14639
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
philipp-spiess
commented
Oct 10, 2024
philipp-spiess
commented
Oct 10, 2024
philipp-spiess
force-pushed
the
feat/migrate-js-config
branch
from
October 10, 2024 15:06
8166259
to
3b62ab7
Compare
philipp-spiess
requested review from
RobinMalfait,
thecrypticace and
adamwathan
October 10, 2024 15:45
philipp-spiess
force-pushed
the
feat/migrate-js-config
branch
from
October 10, 2024 15:47
c7d12f5
to
5e9e78c
Compare
philipp-spiess
commented
Oct 10, 2024
philipp-spiess
commented
Oct 10, 2024
philipp-spiess
commented
Oct 11, 2024
Co-authored-by: Robin Malfait <[email protected]>
philipp-spiess
force-pushed
the
feat/migrate-js-config
branch
from
October 11, 2024 13:16
51fd7af
to
d86af92
Compare
thecrypticace
approved these changes
Oct 11, 2024
adamwathan
reviewed
Oct 11, 2024
} | ||
|
||
// Applies heuristics to determine if we can attempt to migrate the config | ||
function isSimpleConfig(unresolvedConfig: Config, source: string): boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we rename this to something that will remain accurate even as we support more complex configs? Like canMigrateConfig
or something?
This was referenced Oct 11, 2024
Addressed @adamwathan's comments in: #14650 |
philipp-spiess
added a commit
that referenced
this pull request
Oct 11, 2024
) While working on some fixes for #14639 I noticed that the following v3 configuration file would not load properly in v4: ```ts import { type Config } from 'tailwindcss' export default { content: ['./src/**/*.{js,jsx,ts,tsx}'], theme: { extend: { colors: ({ colors }) => ({ gray: colors.neutral, }), }, } satisfies Config ``` The reason for this is that we did not pass the `colors` property to the callback function. Since we have colors available now, we can easily add it. --------- Co-authored-by: Adam Wathan <[email protected]>
philipp-spiess
added a commit
that referenced
this pull request
Oct 14, 2024
This PR adds a few more test cases to #14639 and updates the documentation. --------- Co-authored-by: Jordan Pittman <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements the first version of JS config file migration to CSS. It is based on the most simple config setups we are using in the Tailwind UI templates Commit, Primer, Radiant, and Studio.
The example we use in the integration test is a config that looks like this:
As you can see, this file only has a
darkMode
selector, customcontent
globs, atheme
(with some theme keys being overwriting the default theme and some others extending the defaults). Note that it does not supportplugins
and/orpresets
yet.In the case above, we will find the CSS file containing the existing
@tailwind
directives and are migrating it to the following:This replicates all features of the JS config so we can even delete the existing JS config in this case.